UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+zdDDwB+MO7ewGhb0c1aMnxsmsZ8TrtIbb60wryQSk=' 
WHERE 
  key_id = '304d1538b8a188018fd6186236513bbe510df9ba1da3b34caaa1b71a9e2d03a1' 
  AND (
    token = 'B+zdDDwB+MO7ewGhb0c1aMnxsmsZ8TrtIbb60wryQSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038