UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5SVg/5ympI8kP8QmewaHB3ZXdJF5XiyKPUXfVJ19e4w='
WHERE
key_id = '4f5b3fbeedda309d60a80e4897309476395d325423e5053d40475c2a097f87c8'
AND (
token = '5SVg/5ympI8kP8QmewaHB3ZXdJF5XiyKPUXfVJ19e4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)