UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jPA+G2ofcrCBnwrth3Pviu5LMaH/ojfDXy+ltm8salo=' 
WHERE 
  key_id = 'b64d3428820155c8e641d83009b07d1aa337b7c56d405c55fa22dec815040b20' 
  AND (
    token = 'jPA+G2ofcrCBnwrth3Pviu5LMaH/ojfDXy+ltm8salo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047