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