UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lgM5HscLSK7bPK4rFUSAa7+G1XNgV7tqrZP64Rcgd9c=' 
WHERE 
  key_id = 'a29f7253659b8fc6fff9550ee8ff0cea7e8686c3e24066518c3d80cb7efe245a' 
  AND (
    token = 'lgM5HscLSK7bPK4rFUSAa7+G1XNgV7tqrZP64Rcgd9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039