UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NnDAO1rihEt5bPLVseAduUEpYNR5rrI7XHeGRQSY+T0='
WHERE
key_id = 'ba065ec9f7c973fb6ac68d0418599fedfff58e0910cacfe4c9849d5b9ac8eccd'
AND (
token = 'NnDAO1rihEt5bPLVseAduUEpYNR5rrI7XHeGRQSY+T0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)