UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4FQs57Pb3ZNjfjawl7HYMxrcOAp9DDq2FmVGbtN3ixc='
WHERE
key_id = '1c07dac6c1be8e999fd92183a4a2ddf0162c306d291bfc2fd3f77dfa80b30dff'
AND (
token = '4FQs57Pb3ZNjfjawl7HYMxrcOAp9DDq2FmVGbtN3ixc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)