UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1mOJryI6r3xhGdYkglCGCh2mBcUv2c9xDxHLwTBmDlw='
WHERE
key_id = 'ddd8a9ee5f85ba147ece378942cbcb306aa27beabc47958048520371e59cdcdd'
AND (
token = '1mOJryI6r3xhGdYkglCGCh2mBcUv2c9xDxHLwTBmDlw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)