UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sOAbui4wdLveDS2L4yrezb7fAzWAXH2RSIM7FIW5dFQ='
WHERE
key_id = 'edccae969ae7ed33e7eb9a0e407721aaee5c4ca90169b836de3d488f04f01418'
AND (
token = 'sOAbui4wdLveDS2L4yrezb7fAzWAXH2RSIM7FIW5dFQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)