UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rpywJbE6/WUvpaQLZDiXwRz1zNayVbCLQ5VonqNH+hw=' 
WHERE 
  key_id = '647955ac6b8815790c26d6ea3b51b6c5d04746979f8a4a099b46021f4ba0affe' 
  AND (
    token = 'rpywJbE6/WUvpaQLZDiXwRz1zNayVbCLQ5VonqNH+hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023