UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X5J+ZJs7tWIZ86IjzzLW9JSljbNdwxdXfONsTrcrSB4='
WHERE
key_id = 'be2460789052a0f237953e6065f4d56edf3b1f9978e1fab701c8dd1cd4b3af43'
AND (
token = 'X5J+ZJs7tWIZ86IjzzLW9JSljbNdwxdXfONsTrcrSB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)