UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rUswiiZNRdbWp8fpyWGKvklyK5GZJYlaXl2qqEuBu+o='
WHERE
key_id = '20217e690bab3e6728b93a59e76244156438d56140854a543f73dfd46ba4294d'
AND (
token = 'rUswiiZNRdbWp8fpyWGKvklyK5GZJYlaXl2qqEuBu+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)