UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MUAwKJvjuygycq+8ijw4mK1J+WkdN1PxuJ40qLlq57M='
WHERE
key_id = '6f57b66e27020faa01c912fed2c0f9be454d31efddfc385774d78252a018a430'
AND (
token = 'MUAwKJvjuygycq+8ijw4mK1J+WkdN1PxuJ40qLlq57M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)