UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AIw2EzYMWV+ivlyOMRU16f7NirbVNPQS/G2orKfReAM='
WHERE
key_id = 'da85d5d27cadb80c6210a7cd3dc1d3e0226ce392a7d33334067cbdc923f4f1a3'
AND (
token = 'AIw2EzYMWV+ivlyOMRU16f7NirbVNPQS/G2orKfReAM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)