UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OjrrCfALDxOQa1iuqkLjK9LD696MSlcdU3PGrWhGhGk=' 
WHERE 
  key_id = '65ebe9787c5ee72f81fe4b502214cef275d359595fcc0ab31f143196b76496bf' 
  AND (
    token = 'OjrrCfALDxOQa1iuqkLjK9LD696MSlcdU3PGrWhGhGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045