UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QSIj/UCSmkY0ufpCDJ8KR2+ztbKofHRPqIZtdDUEWFw=' 
WHERE 
  key_id = '0f5c5b6278ded7044aed51646057a9491029684002b8a090d51169194e62d90e' 
  AND (
    token = 'QSIj/UCSmkY0ufpCDJ8KR2+ztbKofHRPqIZtdDUEWFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017