UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mnwY74dXoxRWBLvzPDFcGxTHybT7jOJTmasaimt+4P4=' 
WHERE 
  key_id = '55979f225b7cab34f8d99051ff38972467866b5c9a047c4f485512ceaee45e94' 
  AND (
    token = 'mnwY74dXoxRWBLvzPDFcGxTHybT7jOJTmasaimt+4P4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046