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