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

Query time 0.00028