UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Uku7UQtfW503jdqYK0GaRxmFIcP3psBnFVIHVS3H9nM='
WHERE
key_id = '7387f9805225b058c1ad4b98deb8455461d56f477e77ea533b1098f7989cf0ec'
AND (
token = 'Uku7UQtfW503jdqYK0GaRxmFIcP3psBnFVIHVS3H9nM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)