UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cMEso9Wdk/RdAg1RH7Q59R9t44iJ1sWx24irqjmh7DY='
WHERE
key_id = 'e1fb67c9942a02813e7ac45e69680f5f15a90c7ad8d5fce8f3d407793a708d07'
AND (
token = 'cMEso9Wdk/RdAg1RH7Q59R9t44iJ1sWx24irqjmh7DY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)