UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xfe+8TYZINQqd1CSIGU5jhgtK8l3gY5yeVQOUCS2A20=' 
WHERE 
  key_id = 'a3b48c49665329ee67045c2a6e81431ea58da65f3c21e85d792815ff37d9bf1a' 
  AND (
    token = 'Xfe+8TYZINQqd1CSIGU5jhgtK8l3gY5yeVQOUCS2A20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027