UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xUHKtSQvKk2st0ArCHfpZ629fYIVudYfPZ28boHq3Oo='
WHERE
key_id = 'a58fbcb8ff4cb55c6018d5930cdb7f1810699e2362a0ecced0c329142dd2ce57'
AND (
token = 'xUHKtSQvKk2st0ArCHfpZ629fYIVudYfPZ28boHq3Oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)