UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OdHuMn6ls1I35YY5q1VRFUIzO0SHuFAcjNuc9PdJJM8=' 
WHERE 
  key_id = '3c44ab9f1267d2045296698efbdeb529ee2469b1305a4d2f04f73aa2bb6a0155' 
  AND (
    token = 'OdHuMn6ls1I35YY5q1VRFUIzO0SHuFAcjNuc9PdJJM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037