UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fdOBMz9X6x7TuCDuthE1n+vvhfUVhZRq0O6PShnozO8=' 
WHERE 
  key_id = '4cdf25f5ba649a0dcdfaaae2b4de16d591fac174a39306a21189471d4d045c4b' 
  AND (
    token = 'fdOBMz9X6x7TuCDuthE1n+vvhfUVhZRq0O6PShnozO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037