UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bAHF5ZEQYxcjn6I5862i9lRz7wi4Lbsf7xCaY7i5Hng=' 
WHERE 
  key_id = '3795305da10bd0cd1b2bb2d477fec3bd9acf722abb87e34f3cf00aaca65dd87c' 
  AND (
    token = 'bAHF5ZEQYxcjn6I5862i9lRz7wi4Lbsf7xCaY7i5Hng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019