UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D0MyfthGOQSW8ndXP3jSZNa4lbqNdfmpewi3X+fnz9k='
WHERE
key_id = '78f4be9e6c4ecbcc68ca05899b9346188094bfd375603e1b53b81dd2d6a32d5e'
AND (
token = 'D0MyfthGOQSW8ndXP3jSZNa4lbqNdfmpewi3X+fnz9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)