UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hQ3Br99sh2XoBylwc4r39aHxoFGUG2+iOJ71fCsJMbM=' 
WHERE 
  key_id = 'e249b5d8d4526c312f857f18e723d84a5d84b686aa1267beb3640f4b1138609f' 
  AND (
    token = 'hQ3Br99sh2XoBylwc4r39aHxoFGUG2+iOJ71fCsJMbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031