UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HxdB5dpi61oS8BFqcjjGfHNNJYFWBoIfg7vCcNojhpE=' 
WHERE 
  key_id = '89350c95d760e84fd7514e77481fdeb50de4a095a2125d584a2a3ed05d013deb' 
  AND (
    token = 'HxdB5dpi61oS8BFqcjjGfHNNJYFWBoIfg7vCcNojhpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051