UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KgyJ3KgY52nsvk/10u5+CebXI0wcwW0J8yhkdrG0RaI='
WHERE
key_id = '171ae82d2b40c401955074da70d2bf831662da9c7012cddb91bad8fea33c25ab'
AND (
token = 'KgyJ3KgY52nsvk/10u5+CebXI0wcwW0J8yhkdrG0RaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)