UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+b4n9r7DjftD+Fy/+bh+w8PLruastDn4Yl1wnkOyPYU=' 
WHERE 
  key_id = 'a20997d72ddb04966a1d0e46e649451df317814b19d09f8f9072985ef6f9176c' 
  AND (
    token = '+b4n9r7DjftD+Fy/+bh+w8PLruastDn4Yl1wnkOyPYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039