UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bw8GNd6nDGq3XziuQqhQp0QBBCZg+38NoT92jmDN5Bw=' 
WHERE 
  key_id = '7ba3e949d9ea60b5f8e86202170bd84f52be6098b0061f32f1062d96f0ff38f2' 
  AND (
    token = 'bw8GNd6nDGq3XziuQqhQp0QBBCZg+38NoT92jmDN5Bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040