UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SduU/XQcUBbD1hIDBLT0GC6R6fw7v3KEADquNMSQv6s='
WHERE
key_id = 'c5b8b3599b0d8d475162a4655e0049466d67c6cb26597ffa37fe6860d974cd1f'
AND (
token = 'SduU/XQcUBbD1hIDBLT0GC6R6fw7v3KEADquNMSQv6s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)