UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nyC9ZX8bvXASV038h0lToZpW07G2PkA/dYw7U2xGRgk=' 
WHERE 
  key_id = '27ae9e771a356c2f1bfd52d36c1560b3c96d3c2c119438043c40a94f7707f0e1' 
  AND (
    token = 'nyC9ZX8bvXASV038h0lToZpW07G2PkA/dYw7U2xGRgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032