UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TGB6eNSBz+qqxgxTumgYxzr8E+qocANjuqkV7Hz/TeI='
WHERE
key_id = 'a5948a066b20d3ba03a5dcfe5c0479c94e4fcdaa0913f6bec91c0fff70afa914'
AND (
token = 'TGB6eNSBz+qqxgxTumgYxzr8E+qocANjuqkV7Hz/TeI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)