UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CWlNBeLX2dbU91f4wJqDqF4kABdhtCJgxs3VngnqZZo='
WHERE
key_id = '8d5ac0e7609876656ca1e17a8916a879056918c04045c902900f0aa0c7a24a74'
AND (
token = 'CWlNBeLX2dbU91f4wJqDqF4kABdhtCJgxs3VngnqZZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)