UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p1DCzzRdbPYDqXbpy7wYmX2oJGQvLCWx8CrHR4opDuE='
WHERE
key_id = '16a6aacc39d3621b4f225937a84e90e59e0fa3abdaf15d2d8e1242f38a0e4859'
AND (
token = 'p1DCzzRdbPYDqXbpy7wYmX2oJGQvLCWx8CrHR4opDuE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)