UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uv3k8kMMT8omnZBme7wxskUHBV/tiHPv03Zxam56mK0=' 
WHERE 
  key_id = 'd87ec1f27a501938456cd6935db7aadebcf3721e6a993e773e86c2b5590f0712' 
  AND (
    token = 'Uv3k8kMMT8omnZBme7wxskUHBV/tiHPv03Zxam56mK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034