UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NTzQFEDvoxvbEiQYvFPysGjb9Y5kvL1a/rDo6h1+MfM=' 
WHERE 
  key_id = '07990677d55bb3825cd00eaffd400dd8aeb4c6884b679736dfd1aa80ab6184f3' 
  AND (
    token = 'NTzQFEDvoxvbEiQYvFPysGjb9Y5kvL1a/rDo6h1+MfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040