UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TanKdW42FNYECDO7MwBqx02O8uN0uvw1XrZsZxVXvuM=' 
WHERE 
  key_id = 'ff82a5056466aa0a8dafc74784774336dbace0d88166018679d55312a439b2fd' 
  AND (
    token = 'TanKdW42FNYECDO7MwBqx02O8uN0uvw1XrZsZxVXvuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030