UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8esnYmjPYmqsiDR05F/nROeoYbqd8A6n3LyPauu1bIo='
WHERE
key_id = 'a6e0b715a3e10af138524614f8c7422635665b5097a57d09055c2658de2dc364'
AND (
token = '8esnYmjPYmqsiDR05F/nROeoYbqd8A6n3LyPauu1bIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)