UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OK4Z5wG/B5MAF7uYWUVIQ8H4mom9LU+yIwvZifKlR7c=' 
WHERE 
  key_id = 'de8546afb7832792222fa79db5e0d85c63c4d3b5292e12e2671a178d0480f8ee' 
  AND (
    token = 'OK4Z5wG/B5MAF7uYWUVIQ8H4mom9LU+yIwvZifKlR7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054